package org.gcb.core.sandbox;

import org.gcb.core.model.Item;

/**
 *
 * @author Jason
 */
public class DefaultSlotModel<Item> extends AbstractSlotModel<Item>{
    protected Item item;

    public DefaultSlotModel() {
	this(null);
    }

    public DefaultSlotModel(Item item) {
	this.item = item;
    }

    @Override
    public Item getItem() {
	return item;
    }

    @Override
    public void setItem(Item item) {
	Item oldItem = this.item;
	this.item = item;
	if (oldItem==null && item!=null) {
	    fireSlotEquip();
	} else {
	    if (item==null) {
		fireSlotUnequip();
	    } else {
		fireSlotSwap();
	    }
	}
    }
}
